package com.scwatch.ext.repository;


import com.scwatch.common.orm.Limitable;
import com.scwatch.ext.domain.LiveBroadcast;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.domain.Specification;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.Repository;

import java.util.Collection;
import java.util.List;
public interface LiveBroadcastDao extends Repository<LiveBroadcast, Integer> {
    public Page<LiveBroadcast> findAll(Specification<LiveBroadcast> spec, Pageable pageable);

    public List<LiveBroadcast> findAll(Specification<LiveBroadcast> spec, Limitable limitable);

    public LiveBroadcast findOne(Integer id);

    public LiveBroadcast save(LiveBroadcast bean);

    public void delete(LiveBroadcast bean);


    @Query("select count(*) from LiveBroadcast bean where bean.site.id in ?1")
    public long countBySiteId(Collection<Integer> siteIds);
}
